import React, { useState } from 'react'
import Test from './Test'

export default function App() {
  const [flag, setFlag] = useState(true)
  return (
    <div>
      <div>{flag && <Test />}</div>
      <button onClick={() => setFlag(false)}>卸载 Test 组件</button>
    </div>
  )
}